package com.ruoyi.searcWord.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.searcWord.domain.SearchWord;
import com.ruoyi.searcWord.mapper.SearchWordMapper;
import com.ruoyi.searcWord.service.ISearchWordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 搜索记录Service业务层处理
 *
 * @author ruoyi
 * @date 2021-12-27
 */
@Service
public class SearchWordServiceImpl implements ISearchWordService
{
    @Autowired
    private SearchWordMapper searchWordMapper;

    /**
     * 查询搜索记录
     *
     * @param id 搜索记录主键
     * @return 搜索记录
     */
    @Override
    public SearchWord selectSearchWordById(Long id)
    {
        return searchWordMapper.selectSearchWordById(id);
    }

    /**
     * 查询搜索记录列表
     *
     * @param searchWord 搜索记录
     * @return 搜索记录
     */
    @Override
    public List<SearchWord> selectSearchWordList(SearchWord searchWord)
    {
        return searchWordMapper.selectSearchWordList(searchWord);
    }

    /**
     * 新增搜索记录
     *
     * @param searchWord 搜索记录
     * @return 结果
     */
    @Override
    public int insertSearchWord(SearchWord searchWord)
    {
        searchWord.setCreateTime(DateUtils.getNowDate());
        return searchWordMapper.insertSearchWord(searchWord);
    }

    /**
     * 修改搜索记录
     *
     * @param searchWord 搜索记录
     * @return 结果
     */
    @Override
    public int updateSearchWord(SearchWord searchWord)
    {
        searchWord.setUpdateTime(DateUtils.getNowDate());
        return searchWordMapper.updateSearchWord(searchWord);
    }

    /**
     * 批量删除搜索记录
     *
     * @param ids 需要删除的搜索记录主键
     * @return 结果
     */
    @Override
    public int deleteSearchWordByIds(Long[] ids)
    {
        return searchWordMapper.deleteSearchWordByIds(ids);
    }


    /**
     * 批量逻辑删除搜索记录
     *
     * @param ids 需要删除的搜索记录主键
     * @return 结果
     */
    @Override
    public int logicDeleteSearchWord(Long[] ids,String delType,Long delUser)
    {
        return searchWordMapper.logicDeleteSearchWord(ids,delType,delUser);
    }

    /**
     * 删除搜索记录信息
     *
     * @param id 搜索记录主键
     * @return 结果
     */
    @Override
    public int deleteSearchWordById(Long id)
    {
        return searchWordMapper.deleteSearchWordById(id);
    }
}
